package com.gateway.server.model;

import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;

import java.io.Serializable;

/**
 * 返回信息实体
 *
 * @Author yin_q
 * @Date 2019/8/28 15:59
 * @Email yin_qingqin@163.com
 **/
@JsonInclude(JsonInclude.Include.NON_NULL)
@Data
public class Result<T> implements Serializable {

    private Integer code;

    private String msg;

    private T data;

    public Result(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    /**
     * 失败返回值
     * @param code
     * @param msg
     * @return
     */
    public static Result failure(Integer code, String msg){
        return new Result(code, msg);
    }

}
